package com.eurobcoin.user;

import java.io.Serializable;

import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.stereotype.Component;

@Component("user")
@Scope(value="session", proxyMode=ScopedProxyMode.TARGET_CLASS)
public class UserSession implements Serializable {
	
	private static final long serialVersionUID = -5944792254228509448L;
	
	public static final int DEFAULT_TRADING_PAIR = 1;

	private UserModel userModel;
	
	private boolean authenticated;
	
	private int tradingPair;
	
	public UserSession() {
		this.userModel = new UserModel();
		this.tradingPair = DEFAULT_TRADING_PAIR;
	}
	
	public UserModel getUserModel() {
		return userModel;
	}

	public void setUserModel(UserModel userModel) {
		this.userModel = userModel;
	}
	
	public void reset() {
		this.userModel.reset();
		this.authenticated = false;
		this.tradingPair = DEFAULT_TRADING_PAIR;
	}

	public boolean isAuthenticated() {
		return authenticated;
	}

	public void setAuthenticated(boolean authenticated) {
		this.authenticated = authenticated;
	}

	public int getTradingPair() {
		return tradingPair;
	}

	public void setTradingPair(int tradingPair) {
		this.tradingPair = tradingPair;
	}
	
}
